package jrobutt.loader;

import jrobutt.*;

import com.google.gson.Gson;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;

public class JsonLoader<T> extends ResourceLoader<T>
{
    public static final Gson json = new Gson();
    public final Class<T> clazz;
    
    public JsonLoader (Class<T> clazz) // i freaking hate you, jabber
    {
        this.clazz = clazz;
    }
    
    protected T get_data (InputStream istream) throws IOException
    {
        return json.fromJson(new InputStreamReader(istream), clazz);
    }
}
